package model;

import java.awt.Color;
import java.awt.Component;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.border.LineBorder;
import javax.swing.table.TableCellRenderer;

public class JButtonCellRenderer extends JButton implements TableCellRenderer {
    private static final long serialVersionUID = -9054616777819368609L;

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
	    boolean isSelect, boolean hasFocus, int row, int col) {
	if (col == 6) {
	    this.setText("Edit");
	}
	if (col == 7) {
	    this.setText("Edit");
	}
	if (col == 8) {
	    this.setText("Edit");
	}
	if (col == 9) {
	    this.setText("Update");
	}
	if (col == 10) {
	    this.setText("Undo");
	}
	if (col == 11) {
	    this.setText("Delete");
	}

	if (isSelect) {
	    this.setForeground(null);
	} else {
	    this.setForeground(Color.GRAY);
	}

	this.setMargin(new Insets(2, 2, 2, 2));
	this.setBorder(new LineBorder(new Color(0, 0, 0)));

	return this;
    }
}
